package com.simpou.commons.model.entity;

import com.simpou.commons.model.IdentifiableModelDelegate;
import java.io.Serializable;
import lombok.Delegate;
import lombok.RequiredArgsConstructor;

/**
 * Entidade identificável concreta.
 *
 * @author Jonas Pereira
 * @since 2013-06-06
 * @version 2013-06-30
 */
@RequiredArgsConstructor
public abstract class AbstractIdentifiableEntity<T extends Serializable>
        extends AbstractEntity
        implements IdentifiableEntity<T> {
     
    @Delegate
    private final IdentifiableModelDelegate<T> identifiableModel;

    public AbstractIdentifiableEntity(Class<T> clasz) {
        this.identifiableModel = new IdentifiableModelDelegate<T>(clasz);
    }

    @Override
    public final boolean equals(Object obj) {
        return identifiableModel.equals(this, obj);
    }

    @Override
    public final int hashCode() {
        return identifiableModel.hashCode();
    }
   
}
